<tagLib name="strends" />
<include file="Public:header" />
<table cellpadding="4" cellspacing="0" border="0" class="table-form">
		<tr>
			<td style="padding-left:30px;font-weight:bold;color:#1E325C;" >tid</td>
			<td style="padding-left:30px;font-weight:bold;color:#1E325C;">标题</td>
			<td style="padding-left:30px;font-weight:bold;color:#1E325C;">作者</td>
			<td style="padding-left:30px;font-weight:bold;color:#1E325C;">人气</td>
			<td style="padding-left:30px;font-weight:bold;color:#1E325C;">发布时间(dateline)</td>
			<td style="padding-left:30px;font-weight:bold;color:#1E325C;">最后上传时间(lastpost)</td>
			<td style="padding-left:10px;font-weight:bold;color:#1E325C;">操作</td>
		</tr>
	<foreach name="list" item="vo" >
		<tr  >
			<td style="padding-left:30px;">{$vo.tid}</td>
			<td style="padding-left:30px;"  >
				<a class="show" name="{$vo.attachment}"  href="javascript:;">{$vo.subject}</a>
			</td>
			<td style="padding-left:30px;">{$vo.author}</td>
			<td style="padding-left:30px;">{$vo.views}</td>
			<td style="padding-left:30px;">{$vo.dateline}</td>
			<td style="padding-left:30px;">{$vo.lastpost}</td>
			
			<td>
				<if condition="($vo.recommend eq 1)">
					<a href="javascript:;" name="{$vo.tid}" value="yes" class="tui">以推荐</a>
				<else /> 
					<a href="javascript:;" name="{$vo.tid}" value="no" class="butui">未推荐</a>
				</if>
			</td>
		</tr>
		
	</foreach>
	
	<script>
		$(function (){
			$(".tui").click(function (){
				var id=$(this).attr("name");
				var type=$(this).attr("value");
				var urla="/trends/index.php?m=Threads&a=recommend&id="+id+"&type="+type;
				$.ajax({
					type: "POST",
					url: urla,
					rsync: false,
					dataType: "script",
					success:function (data){
						if(data=="OK"){
							alert("推荐成功");
						}else{
							alert("推荐失败");
						}
					},
					error:function (date){
						alert("失败");
					}
				})
			});
			
			$(".butui").click(function (){
				var id=$(this).attr("name");
				var type=$(this).attr("value");
				var urls="/trends/index.php?m=Threads&a=recommend&id="+id+"&type="+type;
				
				$.ajax({
					type: "POST",
					url: urls,
					rsync: false,
					dataType: "script",
					success:function (data){
						if(data=="OK"){
							alert("推荐成功");
						}else{
							alert("推荐失败");
						}
					},
					error:function (date){
						alert("失败");
					}
				}) 
			});

			$(".show").mouseover(function (){
				var ev=window.event;
				var iL=ev.clientX;
				var iT=(ev.clientY-170);
				
				$('#show').css("display","block");
				$('#show').css("top",iT);
				$('#show').css("left",iL);
				
				var name=$(this).attr('name');
				$('#show').find("img").attr("src",name);
			});
			$(".show").mouseout(function (){
				$('#show').css("display","none");
				$('#show').find("img").attr("src","");
			});
		});
	</script>
</table>
<span  width="500px"  style="display:inline-block;margin-left:35%;">{$page}</span>
<div id="show" style="display:none;position:absolute;width:219px;height:160px;top:0px;left:0px;">
	<img  src="" width="219" height="151"/>
</div>
<include file="Public:footer" />